package com.mjlf.mqserver.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.mjlf.mqserver.entity.Topic;
import com.mjlf.mqserver.server.TopicMqServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName TopicController
 * @Author mjlft
 * @Date 2020/2/19 10:53
 * @Version 1.0
 * @Description TODO
 */
@RestController
public class TopicController {
    @Autowired
    private TopicMqServer topicServer;

    @PostMapping("/createTopic")
    public JSONObject createTopic(@RequestBody Topic topic) throws Exception {
        return JSON.parseObject(topicServer.createTopic(topic));
    }
}
